<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
		<link rel="stylesheet" href="editormd.preview.css" />
		<script type="text/javascript" src="../js/uni.webview.1.5.5.js"></script>
		<!-- <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" /> -->
		<style>
			.editormd-html-preview {
				width: 100%;
				margin: 0 auto;
				overflow: hidden;
				padding: 0px !important;
			}
			
			html,body{
				margin: 0;
				padding: 0;
				
			}
		</style>
	</head>
	<body>
		<div id="layout">
			<div id="test-editormd-view">
			</div>
		</div>
		<script src="js/jquery.min.js"></script>
		<script src="lib/marked.min.js"></script>
		<script src="lib/prettify.min.js"></script>
		<script src="lib/raphael.min.js"></script>
		<script src="lib/underscore.min.js"></script>
		<script src="lib/sequence-diagram.min.js"></script>
		<script src="lib/flowchart.min.js"></script>
		<script src="lib/jquery.flowchart.min.js"></script>

		<script src="editormd.js"></script>
		<script type="text/javascript">
		function markdown(nr){
			let content = ''
			if(typeof nr == 'string'){
				content = decodeURIComponent(JSON.parse(nr).value)
			}else{
				content = decodeURIComponent(nr.value)
			}
			$('#test-editormd-view').text('')
			
			var testEditormdView = editormd.markdownToHTML("test-editormd-view", {
				markdown: content, 
				htmlDecode      : true, 
				toc             : true,
				tocm: true, // Using [TOCM]
				emoji: true,
				taskList: true,
				tex: true, // 默认不解析
				flowChart: true, // 默认不解析
				sequenceDiagram: true, // 默认不解析
			});
		}
		
		// 在iframe内部执行以下代码
		var iframeId = window.frameElement.getAttribute('id');
		// 或者使用简写形式（两者等价）
		var iframeId = this.frameElement.id;
		// 等待初始化完毕
		document.addEventListener('UniAppJSBridgeReady', () => {
			window.parent.postMessage({ action: 'onJSBridgeReady', data: '',iframeId:iframeId}, '*');
			uni.postMessage({
				data: {
					action: 'onJSBridgeReady'
				}
			})
			
		})
		
		
		</script>
	</body>
</html>